﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Script.UI;
using UnityEngine.UI;
using XCharts;
using Script.UI.Component;
using LitJson;
using MTUnity.Utils;
using System;
using DG.Tweening.CustomPlugins;
using Script.UI.Panel.OverviewWnd2;

public class UI_Overview2 : MonoSingle<UI_Overview2>
{
    public Text Txt_CurrentSortingCount;
    
    public Slider Sld_SortingCount;
    public Text SortingLineSlderPercent;
    public Text SortingLineSlderValue;

    
    public Text Txt_RefreshTimeEnergy;
    public Text Txt_RefreshTimeSortLine;
    public Text Txt_RefreshTimeGongDan;

    
    public Text TotalEnergy;
    public SliderModule module;

    public void CurrentEnergyUpdate(MTJSONObject obj)
    {
        TotalEnergy.text = obj.i.ToString();
        Txt_RefreshTimeEnergy.text = string.Format("数据更新 {0}", System.DateTime.Now.ToString("{yyyy-MM-dd HH:mm:ss}"));

    }

    public void CurrentSortingDataUpdate(MTJSONObject obj)
    {
        SortingLineSlderValue.text = obj["complete"].i.ToString();
        Txt_CurrentSortingCount.text =  obj["total"].i.ToString();
        SortingLineSlderPercent.text = (obj["complete"].i / obj["total"].f * 100).ToString() + "%";
        Sld_SortingCount.value = (obj["complete"].i / obj["total"].f);
        Txt_RefreshTimeSortLine.text = string.Format("数据更新 {0}", System.DateTime.Now.ToString("{yyyy-MM-dd HH:mm:ss}"));
    }

    public void RecordWorkOrderUpdate(MTJSONObject obj)
    {
        module.RefreshSlider(obj);
        Txt_RefreshTimeGongDan.text = string.Format("数据更新 {0}", System.DateTime.Now.ToString("{yyyy-MM-dd HH:mm:ss}"));

    }
}
